<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:gd="http://gdziarmaga.com/webshop/web/jsf">

<ui:composition>
	<h:outputStylesheet library="css" name="components/rich_dataGrid.css" />
	<h:outputStylesheet library="css" name="pages/bookTable.css" />

	<rich:panel id="bookTable">
		<h:form>
			<rich:dataGrid style="width:100%;" value="#{bookMenuBean.book_list}"
				var="var" columns="2" elements="12" first="1">
				<f:facet name="header">
					<h:outputText value="#{flash.keep.section}"></h:outputText>
				</f:facet>
				<rich:panel styleClass="oneBookDescriptionCell">
					<h:panelGrid columns="2">
						<h:panelGroup layout="block">
							<h:commandLink actionListener="#{bookTableBean.choiceBook}"
								action="#{jsfutils.redirect('mainContent/bookPresentationPage')}">
								<h:graphicImage library="images" name="#{var.icon}"
									id="leftSidebar"></h:graphicImage>
								<f:attribute name="selectedBookId" value="#{var.book_id}" />
							</h:commandLink>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText styleClass="bookTitle" value="#{var.title}" />
							<rich:panel bodyClass="addToCart" style="cursor: pointer;">
								<f:ajax event="click" listener="#{basketBean.addBook}" render="@all"/>
								<f:attribute name="book" value="#{var}"/>
							
								Cena:
								<h:outputText style="font-size: 15px;" value="#{var.price}">
									<f:convertNumber type="currency" pattern="  #0.00zł" />
								</h:outputText>
							</rich:panel>
						</h:panelGroup>
					</h:panelGrid>
					<rich:panel bodyClass="shortDescription">
						<h:outputText escape="false" value="#{var.short_descripton}" />
					</rich:panel>
				</rich:panel>

				<f:facet name="footer">
					<rich:dataScroller boundaryControls="auto"
						tableStyleClass="dataScroller" maxPages="5" />
				</f:facet>
			</rich:dataGrid>
		</h:form>
	</rich:panel>


</ui:composition>
</html>
